/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package javaapplication2;

import java.io.*;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.util.*;

public class Main {

    BufferedReader reader;
    StringTokenizer token;
    long[] vt = new long[110];
    BigInteger[][] dp = new BigInteger[110][110];
    int N;

    public static void main(String[] args) throws IOException {
        Main ob = new Main();
        ob.run();
        System.exit(0);
    }

    public void run() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        //reader = new BufferedReader(new FileReader("in"));
        String line;
        N = 1;
        while ((line = reader.readLine()) != null) {
            doRest(line);
        }
    }

    public void doRest(String line) throws IOException {
        token = new StringTokenizer(line);

        while (token.hasMoreTokens()) {
            long X = nextL(token.nextToken());
            if (X == -999999) {
                Proc();
                N = 1;
            } else {
                vt[N] = X;
                ++N;
            }

        }
    }

    public void Proc() {

        //initialize
        for (int i = 0; i <= 100; ++i) {
            for (int j = 0; j <= 100; ++j) {
                dp[i][j] = BigInteger.ONE;
            }
        }

        BigInteger mx = BigInteger.ONE;

        for (int i = 1; i < N; ++i) {
            if (i == 1) {
                dp[i][1] = BigInteger.valueOf(vt[i]);
                mx = dp[i][1];
                continue;
            }
            for (int j = i, k = 1; j >= 1; --j, ++k) {
                if (k == 1) {
                    dp[i][k] = BigInteger.valueOf(vt[i]);
                } else {
                    dp[i][k] = dp[i - 1][k - 1].multiply(BigInteger.valueOf(vt[i]));
                }

                if (dp[i][k].compareTo(mx) == 1) {
                    mx = dp[i][k];
                }
            }
        }
        System.out.println(mx);
    }

    public long nextL(String ss) {
        return Long.parseLong(ss);
    }
}
